# Maintainer: Michał Adamski <michal@ert.pl>
pkgname=libsecp256k1
pkgver=0_git20211025
pkgrel=1
_gitrev=3e7b2ea1946a7ba069c6d58c45b0d8cdc6c06f0c
pkgdesc="Optimized C library for EC operations on curve secp256k1"
url="https://github.com/bitcoin-core/secp256k1"
arch="all"
license="MIT"
makedepends="autoconf automake libtool"
subpackages="$pkgname-dev"
source="https://github.com/bitcoin-core/secp256k1/archive/$_gitrev/secp256k1-$_gitrev.tar.gz"
builddir="$srcdir/secp256k1-$_gitrev"

prepare() {
	default_prepare
	./autogen.sh
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--disable-static \
		--enable-module-ecdh \
		--enable-module-recovery
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}
sha512sums="
fcaf358cbb2c32a12ab8cbc33cfb95442fa4d241903e75830df4539658e0d22e67170c0f491b852f7b1523204f874be685c17a4e6c18e34490ffef4b2d62e853  secp256k1-3e7b2ea1946a7ba069c6d58c45b0d8cdc6c06f0c.tar.gz
"
